﻿/* ------------------------------------------- TASK GRID EVENTS -------------------------------------------------------- */
/* ------------------------------------------- TASK GRID EVENTS -------------------------------------------------------- */
/* ------------------------------------------- TASK GRID EVENTS -------------------------------------------------------- */
$(function () {
    $(".requesttoken input").removeAttr("disabled");

    $("select#ddlProject").change(function (evt) {
        GetProjectData();
    });

    $("select#ddlEngineers").change(function (evt) {
        if ($("select#ddlEngineers").val() != "-1" && $("select#ddlEngineers").val() != "" && $("select#ddlEngineers").val() != null) {
            // Get user id
            var userId = $("select#ddlEngineers").val();
            // Get project that belong to user
            GetProjectListByUserId(userId);
        }
        else {
            // Clear all grid's data
            ClearGridData();
        }
    });

});


/* ------------------------------------------- TASK GRID EVENTS -------------------------------------------------------- */
/* ------------------------------------------- TASK GRID EVENTS -------------------------------------------------------- */
/* ------------------------------------------- TASK GRID EVENTS -------------------------------------------------------- */
$(function () {
    // Ajax request when a row is clicked
    $('#ajaxGridTask tbody tr').click(function () {
        // highlight selected row
        $('#ajaxGridTask tbody tr').each(
            function () {
                $(this).removeClass('selected');
            }
        );
        $(this).addClass('selected');

        // Get task id
        var currentTaskId = $(this).find('td:first').text();
        $('#txtTaskId').val(currentTaskId);

        LoadActualResourceUsage(currentTaskId);



    });
});
